﻿@inject IHttpService _httpService
@inject NavigationManager NavigationManager
@inject IPageModelCatche<List<StallInfoViewModel>> _pageModelCatche
@inject IConfiguration _configuration

@if (Model != null)
{
    <div class="home-stall-group-card mb-4">
        <CnGalWebSite.Components.Containers.MasaTitleContainer Outline Title="橱窗" Icon="@IconType.Stall.ToIconString()" ShowMoreButton Href="/stall">
             <CnGalWebSite.ProjectSite.Shared.Components.Shared.SlideGroup Items="Model">
                 <CnGalWebSite.ProjectSite.Shared.Components.Shared.InfoCards.StallInfoCard Model="context"/>
             </CnGalWebSite.ProjectSite.Shared.Components.Shared.SlideGroup>
         </CnGalWebSite.Components.Containers.MasaTitleContainer>
     </div>
}

@code {
    List<StallInfoViewModel> Model { get; set; }

    [CascadingParameter]
    public ErrorHandler ErrorHandler { get; set; }


    protected override async Task OnInitializedAsync()
    {
        try
        {
            Model = await _httpService.GetAsync<List<StallInfoViewModel>>("api/stall/getall");
            StateHasChanged();
        }
        catch (Exception ex)
        {
            await ErrorHandler.ProcessError(ex, "获取橱窗列表失败");
        }
    }
}
